libname out 'c:\bill\crack\results_revision\2000_pums';
filename ASCIIDAT "c:\bill\crack\results_revision\2000_pums\usa_00075.dat";
libname outmsa00 'c:\bill\crack\results_revision\2000_pums\current_msa\murder_rate';
libname outcs00 'c:\bill\crack\results_revision\2000_pums\current_state\murder_rate';
libname outsob00 'c:\bill\crack\results_revision\2000_pums\state_of_birth\murder_rate';
libname outmsa90 'c:\bill\crack\results_revision\1990_pums\current_msa\murder_rate';
libname outcs90 'c:\bill\crack\results_revision\1990_pums\current_state\murder_rate';
libname outsob90 'c:\bill\crack\results_revision\1990_pums\state_of_birth\murder_rate';


data one;
infile ASCIIDAT pad missover lrecl=99;

input
  YEAR       1-4
  DATANUM    5-6
  SERIAL     7-14
  HHWT       15-24 .2
  STATEFIP   25-26
  METAREA    27-29
  METAREAD   30-33
  GQ         34-34
  PERNUM     35-38
  PERWT      39-48 .2
  AGE        49-51
  SEX        52-52
  MARST      53-53
  BIRTHYR    54-57
  RACE       58-58
  RACED      59-61
  BPL        62-64
  BPLD       65-69
  HISPAN     70-70
  HISPAND    71-73
  EDUC       74-75
  EDUCD      76-78
  EMPSTAT    79-79
  EMPSTATD   80-81
  LABFORCE   82-82
  INCTOT     83-89
  INCWAGE    90-95
  MIGMET5    96-99
;

label
  YEAR     = "Census year"
  DATANUM  = "Data set number"
  SERIAL   = "Household serial number"
  HHWT     = "Household weight"
  STATEFIP = "State (FIPS code)"
  METAREA  = "Metropolitan area [general version]"
  METAREAD = "Metropolitan area [detailed version]"
  GQ       = "Group quarters status"
  PERNUM   = "Person number in sample unit"
  PERWT    = "Person weight"
  AGE      = "Age"
  SEX      = "Sex"
  MARST    = "Marital status"
  BIRTHYR  = "Year of birth"
  RACE     = "Race [general version]"
  RACED    = "Race [detailed version]"
  BPL      = "Birthplace [general version]"
  BPLD     = "Birthplace [detailed version]"
  HISPAN   = "Hispanic origin [general version]"
  HISPAND  = "Hispanic origin [detailed version]"
  EDUC     = "Educational attainment [general version]"
  EDUCD    = "Educational attainment [detailed version]"
  EMPSTAT  = "Employment status [general version]"
  EMPSTATD = "Employment status [detailed version]"
  LABFORCE = "Labor force status"
  INCTOT   = "Total personal income"
  INCWAGE  = "Wage and salary income"
  MIGMET5  = "Metropolitan area of residence 5 years ago"
;

run;
proc contents; run;


* this program constructs the grouped data for current;
* state of residence from the 2000 census;
data outcs00.cs2000;
set one;
if year=2000;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1973<=yearturn18<=1999;  * keep those who turn 18 from 73 to 99;
hsgrad=educd>=62;
anycollege=educd>=65;
fips=statefip;
keep race sex hsgrad anycollege yearturn18 fips perwt;
run;


* this program constructs the grouped data for current;
* state of residence from the 2000 census;
data outsob00.sob2000;
set one;
if year=2000;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1973<=yearturn18<=1999;  * keep those who turn 18 from 73 to 99;
hsgrad=educd>=62;
anycollege=educd>=65;
fips=bpl;
keep race sex hsgrad anycollege yearturn18 fips perwt;




* this program constructs the grouped data for;
* state of birth from the 1990 census;
data outsob90.sob1990;
set one;
if year=1990;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1963<=yearturn18<=1989;  * keep those who turn 18 from 63 to 89;
hsgrad=educd>=62;
anycollege=educd>=65;
fips=bpl;
keep race sex hsgrad anycollege yearturn18 fips perwt;
run;


* this program constructs the grouped data for current;
* state of residence from the 1990 census;
data outcs90.cs1990;
set one;
if year=1990;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1963<=yearturn18<=1989;  * keep those who turn 18 from 63 to 89;
hsgrad=educd>=62;
anycollege=educd>=65;
fips=statefip;
keep race sex hsgrad anycollege yearturn18 fips perwt;
run;


* this program constructs the grouped data for current;
* MSA residence from the 2000 census;
data outmsa00.msa2000;
set one;
if year=2000;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1973<=yearturn18<=1999;  * keep those who turn 18 from 73 to 99;
hsgrad=educd>=62;
anycollege=educd>=65;
if metaread>0;
keep race sex hsgrad anycollege yearturn18 metaread perwt;
run;

* this program constructs the grouped data for current;
* MSA residence from the 1990 census;
data outmsa90.msa1990;
set one;
if year=1990;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1963<=yearturn18<=1989;  * keep those who turn 18 from 73 to 99;
hsgrad=educd>=62;
anycollege=educd>=65;
if metaread>0;
keep race sex hsgrad anycollege yearturn18 metaread perwt;
run;
